package com.moon.app;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;

import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.ImageLoader.ImageListener;
import com.android.volley.toolbox.Volley;
import com.moon.R;
import com.moon.common.AbstractActivity;
import com.moon.constants.MoonConstants;
import com.moon.utils.BitmapImageCache;

/**
 * 显示大图
 * 
 * @author paul
 * @date 2014年5月27日
 */
public class ShowImageActivity extends AbstractActivity{
    ImageView image;
    
    
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        Intent intent = getIntent();
        String url  = intent.getStringExtra(MoonConstants.SHOW_IMAGE_URL);
        
        super.onCreate(savedInstanceState);
        setContentView(R.layout.show_image);
        
        image = (ImageView)findViewById(R.id.image);
        loadImage(MoonConstants.MOON_DOMAIN_STATIC_TOPIC +url,image);
    }
    
    
    private void loadImage(String url,ImageView view) {
        RequestQueue mQueue = Volley.newRequestQueue(this);  
        ImageLoader imageLoader = new ImageLoader(mQueue, BitmapImageCache.getInstance());
        ImageListener listener = ImageLoader.getImageListener(view,
                R.drawable.app_panel_pic_icon, R.drawable.app_panel_pic_icon);
        imageLoader.get(url, listener);
    }
}
